home *** CD-ROM | disk | FTP | other *** search
- /* Scheme In One Define.
-
- The garbage collector, the name and other parts of this program are
-
- * COPYRIGHT (c) 1989 BY *
- * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. *
-
- Conversion to full scheme standard, characters, vectors, ports, complex &
- rational numbers, and other major enhancments by
-
- * Scaglione Ermanno, v. Pirinoli 16 IMPERIA P.M. 18100 ITALY *
-
- Permission to use, copy, modify, distribute and sell this software and its
- documentation for any purpose and without fee is hereby granted, provided
- that the above copyright notice appear in all copies and that both that
- copyright notice and this permission notice appear in supporting
- documentation, and that the name of Paradigm Associates Inc not be used in
- advertising or publicity pertaining to distribution of the software without
- specific, written prior permission.
-
- PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
- IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- */
-
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <setjmp.h>
- #include <signal.h>
- #include <math.h>
-
- #include "siod.h"
-
- LISP inspect(LISP openv)
- {FILE *in,*out;
- LISP myenv,tmp,result;
- int c,d;
- long flag;
- result=truth;
- if(NULLP(openv))
- openv=VCELL(cintern("*cenv*"));
- else if(NENVP(openv))
- err("inspect",openv,ERR_GEN_ARG | ERR_NENV);
- flag=1;
- myenv=openv;
- in = PORTPTR(cdr(val_input_port));
- out = PORTPTR(cdr(val_output_port));
- fput_st(out,"SIOD debugger\n");
- while(flag)
- {fput_st(out,"Command (h for help) : ");
- while(isspace(c=f_getc(in)))
- if(c== EOF)
- err("EOF on standard input",NIL,ERR_GEN);
- while((d=f_getc(in)!='\n')&&(d!=EOF));
- switch(c)
- {case 'h':
- case 'H':
- fput_st(out,"e - shows errobj\n");
- fput_st(out,"b - shows current environment bindings\n");
- fput_st(out,"x - shows current expression\n");
- fput_st(out,"m - shows the last message error\n");
- fput_st(out,"p - moves up to parent environment\n");
- fput_st(out,"s - moves down to son environment\n");
- fput_st(out,"v - evaluates one expression in current environment\n");
- fput_st(out,"h - shows this help\n");
- fput_st(out,"r - reset\n");
- fput_st(out,"q - quits SIOD debugger\n");
- fput_st(out,"g - quits SIOD debugger returning a value\n");
- break;
- case 'v':
- case 'V':
- fput_st(out,"Eval : ");
- lprin1f(leval(lreadf(in),myenv),out);
- fput_st(out,"\n");
- break;
- case 'e':
- case 'E':
- lprin1f(VCELL(sym_errobj),out);
- fput_st(out,"\n");
- break;
- case 'r':
- case 'R':
- setv(cintern("*cargs*"),NIL);
- setv(cintern("*cenv*"),NIL);
- longjmp(errjmp,1);
- break;
- case 'm':
- case 'M':
- fput_st(out,SNAME(sym_err_string));
- fput_st(out,"\n");
- break;
- case 'p':
- case 'P':
- if(NULLP(myenv))
- fput_st(out,"There is no parent environment\n");
- else
- myenv=PARENT(myenv);
- break;
- case 's':
- case 'S':
- if(EQ(myenv,openv))
- fput_st(out,"There is no son environment\n");
- else
- {for(tmp=openv;NEQ(myenv,PARENT(tmp));tmp=PARENT(tmp));
- myenv=tmp;}
- break;
- case 'b':
- case 'B':
- if(NULLP(myenv))
- fput_st(out,"User-global-environment");
- else
- lprin1f(BINDINGS(myenv),out);
- fput_st(out,"\n");
- break;
- case 'x':
- case 'X':
- lprin1f(VCELL(cintern("*cargs*")),out);
- fput_st(out,"\n");
- break;
- case 'q':
- case 'Q':
- flag=0;
- break;
- case 'g':
- case 'G':
- fput_st(out,"Exit with value: ");
- result = lreadf(in);
- flag=0;
- break;
- default:
- fput_st(out,"Unknown command\n");}}
- return(result);}
-
-